<?php
class View_Administration_User_Filter extends View_Administration_User
{
	/**
	 *	Builds edit User View.
	 *	@access		public
	 *	@return		string
	 */
	public function buildContent()
	{
		$config		= $this->registry->get( 'config' );
		$request	= $this->registry->get( 'request' );
		$session	= $this->registry->get( 'session' );
		$auth		= $this->registry->get( 'auth' );
		$words		= $this->words['user']['filterUsers'];

		$user	= new Model_User();
		$fields	= $user->getColumns();
		$opt_order	= array( "" => $words['order_none'] );
		foreach( $fields as $field )
			if( isset( $words['order_'.$field] ) )
				$opt_order[$field]	= $words['order_'.$field];
		if( $select = $session->get( 'administration_users_order' ) )
			$opt_order['_selected']	= $select;
		$values	= array(
			'title'		=> $session->get( 'administration_users_title' ),
			'direction'	=> $session->get( 'administration_users_direction' ),
			'limit'		=> $session->get( 'administration_users_limit' ),
			);
		$sources	= array(
			'opt_order'	=> $opt_order,
			);

		$ui	= $this->buildForm(
			'administration/user',
			'filterUsers',
			'user',
			'filterUsers',
			$values,
			$sources
		);

		$input_button_filter		= $this->html->Button( 'filterUsers', $words['button_filter'], 'but filter' );
		$input_button_reset			= $this->html->LinkButton( "?link=".$request->get( 'link' )."&resetFilters", $words['button_reset'], 'but reset' );
		$ui['field_button_filter']	= $this->html->Field( 'filterUsers', $input_button_filter );
		$ui['field_button_reset']	= $this->html->Field( 'resetFilters', $input_button_reset );
		$ui['form']		= $this->html->Form( 'filterUsers', "?link=".$request->get( 'link' ) );
		$ui['caption']	= $this->html->TableCaption( $words['caption'], 'filter' );
		$ui['colgroup']	= $this->html->ColumnGroup( $words['colgroup'] );
		$ui['heading']	= $words['heading'];

		return $this->loadTemplate( 'administration.user.filter', $ui );
	}
}
?>